{* Smarty *}
{*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-03-28 22:50:18 +0100 (Fri, 28 Mar 2008) $
 * $Rev: 1068 $
 * $Author: gavinspearhead $
 * $Id: viewfiles.tpl 1068 2008-03-28 21:50:18Z gavinspearhead $
 *}
{include file="head.tpl" title=$title}

{capture assign=submit}

<input type="submit" value="{$LN_apply}" class="submit"/>
{if $isadmin neq 0} 
<input type="button" value="{$LN_feeds_addnew}" class="submit" onclick="javascript:edit_rss('new');" />
{/if}
<input type="submit" value="{$LN_export_feeds}" class="submit" name='export'/>
{if $isadmin neq 0 and $urdd_online neq 0} 
<input type="button" value="{$LN_import_feeds}" class="submit" name='export' onclick="javascript:show_popup_remote('loadsettingsdiv','loadsettings', '{$referrer}');"/>
{/if}

{/capture}

{* Capture the skipper: *}
{capture assign=skipper}
<table class="pageskip"><tr>

{* Determine the start/stop page: *}
{assign var="startpage" value="`$currentpage-10`"}
{if $startpage < 1} {assign var="startpage" value="1"} {/if}
{assign var="stoppage" value="`$startpage+20`"}
{if $stoppage > $lastpage} {assign var="stoppage" value=$lastpage} {/if}
{assign var="startpage" value="`$stoppage-20`"}
{if $startpage < 1} {assign var="startpage" value="1"} {/if}

{section name=x loop=$pages}
{* Always do first *}
{if $pages[x].number == 1}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_rssfeeds_page({$pages[x].url})">
	{$pages[x].number}
	</td>
	{if $startpage > 1}
		<td class="spacer">&nbsp;</td>
	{/if}
{* Always do last *}
{elseif $pages[x].number == $lastpage}
	{if $stoppage < $lastpage}
		<td class="spacer">&nbsp;</td>
	{/if}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_rssfeeds_page({$pages[x].url})">
	{$pages[x].number}
	</td>
{* Only do the surrounding ones*}
{elseif $pages[x].number >= $startpage AND $pages[x].number <= $stoppage}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_rssfeeds_page({$pages[x].url})">
	{$pages[x].number}
	</td>
{/if}
{/section}
</tr></table>
{/capture}


<form action="rssfeeds.php" method="post" id="searchrssform">
<div>
{$LN_feeds_searchtext}: 
<input type="hidden" name="challenge" id="challenge_main" value="{$challenge}"/>
<input type="text" name="search" value="{if $search == ''}<{$LN_search}>{else}{$search|escape:htmlall}{/if}" onfocus="if (this.value=='<{$LN_search}>') this.value='';" id="newsearch" size="30"/>
<input type="checkbox" name="search_all" {if $search_all neq 0}checked="checked"{/if} id="search_all"/>{$LN_feeds_hide_empty}
<input type="hidden" name="order" id="rss_search_order" value="{$order}"/>
<input type="hidden" name="order_dir" id="rss_search_order_dir" value="{$order_dir}"/>
<input type="hidden" name="challenge" id="challenge1" value="{$challenge}"/>
<input type="hidden" name="unsubscribed" value="{$unsubscribed}"/>
<input type="hidden" name="oldsearch" value="{$search}" id="oldsearch"/>
<input type="hidden" name="offset" value="{$offset}" id="offset"/>
&nbsp;
<input type="submit" value="{$LN_search}" class="submit"/>
</div>
</form>
<form action="rssfeeds.php" method="post" id="rssfeedsform">
<div>
<input type="hidden" name="order" value="{$order|escape}"/>
<input type="hidden" name="order_dir" value="{$order_dir|escape}"/>
<input type="hidden" name="action" value="foo"/>
<input type="hidden" name="challenge" id="challenge2" value="{$challenge}"/>
{if $unsubscribed eq 0 } <h3>{$LN_ng_subscribed|escape}: {$LN_feeds_rss|escape}</h3> {else} <h3>{$LN_feeds_rss}</h3>{/if}
</div>
<div>
{$submit}
<span class="Message" id="message_bar">&nbsp;{$message}</span>
<br/>

{$skipper}
<table class="newsgroups">
<tr class="head">
<th {popup text=$LN_feeds_tooltip_active }><a href="#" class="head" onclick="javascript:submit_rss_search('subscribed', 'desc');">&nbsp;</a></th>
<th {popup text=$LN_feeds_tooltip_name } class="fixwidth20p"><a href="#" class="head" onclick="javascript:submit_rss_search('name', 'asc');" >{$LN_feeds_name}</a></th>
<th {popup text=$LN_feeds_tooltip_url }><a href="#" class="head" onclick="javascript:submit_rss_search('url', 'asc');" >{$LN_feeds_url}</a></th>
<th {popup text=$LN_feeds_tooltip_auth }><a href="#" class="head" onclick="javascript:submit_rss_search('auth', 'asc');" >{$LN_feeds_auth}</a></th>
<th {popup text=$LN_feeds_tooltip_posts }><a href="#" class="head" onclick="javascript:submit_rss_search('feedcount', 'desc');">{$LN_size}</a></th>
<th {popup text=$LN_feeds_tooltip_lastupdated }><a href="#" class="head" onclick="javascript:submit_rss_search('last_updated', 'desc');">{$LN_feeds_lastupdated}</a></th>
<th {popup text=$LN_feeds_tooltip_expire }><a href="#" class="head" onclick="javascript:submit_rss_search('expire', 'desc');">{$LN_feeds_expire_time}</a></th>
<th {popup text=$LN_feeds_tooltip_visible }><a href="#" class="head" onclick="javascript:submit_rss_search('visible', 'desc');">{$LN_feeds_visible}</a></th>
<th {popup text=$LN_ng_tooltip_minsetsize } class="fixwidth6"><a href="#" class="head" onclick="javascript:submit_rss_search('minsetsize', 'desc');">{$LN_ng_minsetsize}</a></th>
{if $isadmin neq 0 and $urdd_online neq 0 }
<th {popup text=$LN_feeds_tooltip_uepev } class="fixwidth6">{$LN_feeds_uepev}</th>
<th {popup text=$LN_feeds_tooltip_autoupdate }><a href="#" class="head" onclick="javascript:submit_rss_search('refresh_period','desc');">{$LN_feeds_autoupdate}</a></th>
<th {popup text=$LN_feeds_tooltip_time } class="fixwidth5"><a href="#" class="head" onclick="javascript:submit_rss_search('refresh_time', 'asc');">@ {$LN_feeds_time}</a></th>
{/if}
</tr>

{section name=x loop=$allfeeds}
<tr  class="{cycle values="even,odd" name="cycle1"}">
<td>
{if $isadmin neq 0 and $urdd_online neq 0 }
<input type="checkbox" name="subscribed[{$allfeeds[x].id}]" onclick="ToggleRSS({$allfeeds[x].id})" {if $allfeeds[x].active_val neq 0}checked="checked"{/if}/>
{else}
<input type="checkbox" name="subscribed[{$allfeeds[x].id}]" disabled="disabled" {if $allfeeds[x].active_val neq 0}checked="checked"{/if}/>
{/if}
<input type="hidden" name="rssfeed[{$allfeeds[x].id}]" value="{$allfeeds[x].active_val}"/>
<input type="hidden" id="ng_id_{$allfeeds[x].id}" value="{$allfeeds[x].name}"/>
</td>
<td> 
{if $allfeeds[x].active_val eq $RSS_SUBSCRIBED}<a href="rsssets.php?feed_id={$allfeeds[x].id}">{/if}
{$allfeeds[x].name|escape|truncate:$maxstrlen}
{if $allfeeds[x].active_val eq $RSS_SUBSCRIBED}</a>{/if}
</td>
<td>

{$allfeeds[x].url|escape|truncate:$maxstrlen}
</td>
<td>{if $allfeeds[x].authentication eq 1}<img src="{$IMGDIR}/read.png" alt="{$LN_usenet_needsauthentication}" class="noborder" {popup text=$LN_usenet_needsauthentication }/>
{else}
	<img src="{$IMGDIR}/empty.png" class="noborder" alt=""/>
{/if}</td>

<td>{$allfeeds[x].feedcount}</td>
<td>{$allfeeds[x].lastupdated}</td>
<td>
<input type="text" size="2" value="{$allfeeds[x].expire}" name="expire[{$allfeeds[x].id}]" {if $isadmin neq 1 or $urdd_online neq 1} readonly="readonly"{/if}/>
</td>
<td><input type="checkbox" {if $allfeeds[x].visible neq 0} checked="checked" {/if} name="visible[{$allfeeds[x].id}]"/></td>
<td>
<input type="text" size="3" value="{$allfeeds[x].minsetsize}" name="minsetsize[{$allfeeds[x].id}]"/>
<input type="text" size="3" value="{$allfeeds[x].maxsetsize}" name="maxsetsize[{$allfeeds[x].id}]"/>
</td>

{if $allfeeds[x].active_val eq $RSS_SUBSCRIBED and $isadmin neq 0 and $urdd_online neq 0} 
<td>
<img src="{$IMGDIR}/icon_edit.png" alt="Edit" class="noborder buttonlike" {popup text=$LN_feeds_edit } onclick="javascript:edit_rss({$allfeeds[x].id});" />
<img src="{$IMGDIR}/icon_up.png" alt="Update" class="noborder buttonlike" {popup text=$LN_feeds_update } onclick="javascript:ng_action('updaterss', {$allfeeds[x].id}, '{$LN_feeds_update} {$LN_success}',  '{$LN_feeds_update} {$LN_failed}');" />
<img src="{$IMGDIR}/icon_cancel.png" alt="Expire" class="noborder buttonlike" {popup text=$LN_feeds_expire } onclick="javascript:ng_action('expirerss', {$allfeeds[x].id}, '{$LN_feeds_expire} {$LN_success}',  '{$LN_feeds_expire} {$LN_failed}');" />
<img src="{$IMGDIR}/icon_purge.png" alt="Purge" class="noborder buttonlike" {popup text=$LN_feeds_purge } onclick="javascript:ng_action_confirm('purgerss', {$allfeeds[x].id}, '{$LN_feeds_purge} {$LN_success}',  '{$LN_feeds_purge} {$LN_failed}','{$LN_feeds_purge} \'@@\'');" />
<img src="{$IMGDIR}/icon_delete.png" alt="Remove" class="noborder buttonlike" {popup text=$LN_feeds_remove } onclick="javascript:remove_rss({$allfeeds[x].id}, '{$LN_delete} \'{$allfeeds[x].name|escape}\'?' );" />
</td>
{else} 
	{if $isadmin neq 0 and $urdd_online neq 0}
<td>
<img src="{$IMGDIR}/icon_edit.png" alt="Edit" class="noborder" {popup text=$LN_feeds_edit } onclick="javascript:edit_rss({$allfeeds[x].id});" />
<img src="{$IMGDIR}/icon_delete.png" alt="Remove" class="noborder" {popup text=$LN_feeds_remove } onclick="javascript:remove_rss({$allfeeds[x].id}, '{$LN_delete} {$allfeeds[x].name}' );" />
</td>
	{/if}
{/if}

{if $isadmin neq 0 and $urdd_online neq 0}
<td> 
<select name="period[{$allfeeds[x].id}]" size="1" class="update">
{html_options values=$periods_keys output=$periods_texts selected=$allfeeds[x].select}
</select>
</td>
<td> @ <input type="text" id="time1_{$allfeeds[x].id}" name="time1[{$allfeeds[x].id}]" value="{$allfeeds[x].time1}" class="time"/>:<input type="text" id="time2_{$allfeeds[x].id}" class="time" name="time2[{$allfeeds[x].id}]" value="{$allfeeds[x].time2}"/>
</td>
{/if}
</tr>
{/section}
</table>
{$skipper}
<br/>
{$submit} <br/> 
</div>
</form>
<div id="rsseditdiv" class="editrssoff">
</div>
<div id="loadsettingsdiv" class="loadsettingsoff">

</div>

<p>&nbsp;</p>

{include file="foot.tpl"}
